
<template>
  <div><el-dialog
      title="修改信息"
      :visible.sync="dialogVisible"
      width="30%"
  >
  <span> <el-form ref="form" :model="form" label-width="80px">
            <el-form-item label="工号">
      <el-input v-model="form.account"></el-input>
    </el-form-item>
    <el-form-item label="姓名">
      <el-input v-model="form.name"></el-input>
    </el-form-item>
    <el-form-item label="密码">
      <el-input v-model="form.password"></el-input>
    </el-form-item>
        <el-form-item label="性别">
      <el-input v-model="form.gender"></el-input>
    </el-form-item>
        <el-form-item label="民族">
      <el-input v-model="form.nation"></el-input>
    </el-form-item>
  </el-form></span>

    <span slot="footer" class="dialog-footer">
    <el-button @click="dialogVisible = false">取 消</el-button>
    <el-button type="primary" @click="submit">确 定</el-button>
  </span>
  </el-dialog></div>
</template>
<script>
import {_leaderModify} from '../../../../api/super_admin'

export default{
  name: 'LeaderEditDialog',
  data () {
    return {
      dialogVisible: false,
      form: {
        password: '',
        name: '',
        gender: '',
        nation: '',
        account: ''
      }
    }
  },
  methods: {
    show (Leader) {
      this.dialogVisible = true
      this.form = JSON.parse(JSON.stringify(Leader))
    },
    submit () {
      const OBJ = JSON.parse(JSON.stringify(this.form))
      for (let item in OBJ) {
        if (item === '') {
          this.$message({
            message: '所有字段非空',
            type: 'error'
          })
          return
        }
      }
      _leaderModify(OBJ).then(res => {
        if (res.status) {
          this.$message({
            message: '修改成功',
            type: 'success'
          })
          this.dialogVisible = false
          this.$emit('ok')
        } else {
          this.$message({
            message: '修改失败',
            type: 'warning'
          })
        }
      })
    }
  }

}
</script>

<style scoped>

</style>
